#pragma once
#include <vector>
#include "nodes\DynamicSpriteNode.h"
#include "collision\CollisionDetector.h"

enum FireMode {
	FM_SINGLE,
	FM_DOUBLE,
	FM_TRIPLE
};

class BulletSystem {

struct Bullet {
	ds::Sprite* sprite;
	ds::CDHandle handle;
	ds::Vec2 velocity;
	float angle;
};

typedef std::vector<Bullet> Bullets;

public:
	BulletSystem(ds::DynamicSpriteNode* spriteNode) : m_Sprites(spriteNode) , m_FireMode(FM_SINGLE) , m_CD(gEngine->getCollisionDetector()) {}
	~BulletSystem();
	void update(float elapsed);
	void start(const ds::Vec2& position);	
	int getSize() { 
		return m_Bullets.size();
	}
	void remove(uint32 index);
	void clear();
	void setFireMode(FireMode fireMode);
private:
	void start(const ds::Vec2& position,float angle,const ds::Color& color);
	ds::DynamicSpriteNode* m_Sprites;
	Bullets m_Bullets;
	ds::CollisionDetector& m_CD;
	FireMode m_FireMode;
	float m_DoubleTimer;
	float m_TripleTimer;
};

